import axios from 'axios'
import Vue from 'vue'
import { Toast } from 'vant'
Vue.use(Toast)
axios.interceptors.request.use((cfg) => {
  try {
    // if (localStorage.getItem('token')) {
    //   cfg.headers.authorization = localStorage.getItem('token')
    // }
  } catch (e) {
    console.log(e)
  }
  Toast.loading({
    message: '数据加载中...',
    forbidClick: true
  })
  return cfg
})
axios.interceptors.response.use((res)=>{
    Toast.clear()
    return res.data
})

export default axios
